package com.doit.day02;

import com.doit.day01.Util;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import redis.clients.jedis.Jedis;

/*
需求：任务调度系统：生产者不断产生任务，放入task-queue排队
 */
public class Producer {
    public static void main(String[] args) throws InterruptedException {
        Jedis jedis = Util.getJedis();
        while (true){
            //随便来个任务  随机整个字符串
            String taskName = RandomStringUtils.randomAlphabetic(10);
            //将task放到队列里面去
            jedis.lpush("producer",taskName);
            Thread.sleep(RandomUtils.nextInt(100,300));
        }
    }
}
